home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.teleport.com!usenet
- From: GHouck <hksys@teleport.com>
- Newsgroups: comp.lang.c
- Subject: Re: Help:what is wrong this code?
- Date: 12 Apr 1996 03:50:09 GMT
- Organization: systems hk
- Message-ID: <4kkjth$c32@nadine.teleport.com>
- References: <4k3p3q$n76@brahms.udel.edu> <4k4hi3$5hm@sparcserver.lrz-muenchen.de> <Pine.ULT.3.92.960409210416.383A-100000@henson.cc.wwu.edu>
- NNTP-Posting-Host: ip-pdx08-22.teleport.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22 (Windows; I; 32bit)
-
- Norma Mathews <n9341884@henson.cc.wwu.edu> wrote:
- >On 6 Apr 1996, Kurt Watzka wrote:
- >> yuehong@brahms.udel.edu (Yue-hong Zheng) writes:
- >> >Why it give me 0.0000?
- >>
- >> >#include <stdio.h>
- >> >main () {
- >> >double a=9.008;
- >> >printf("%f\n",sqrt(a));
- >> >return 0;
- >> >}
- >
- >your printf specifer needs to be "%lf", not "%f", since a is a double
- >
- Probably more likely because the 'math.h' include file
- is not present, so 'sqrt()' is possibly returning an
- integer by default.
- Yours, Geoff Houck
-
-